/**
 * 功能描述
 */

define(function (require, exports, module) {
	var Form = require("form");
	var store = require("store");
	var activeUser = store.get("user");
    var instance = {
        initComponent: function (params,widget) {
        	var form = new Form({
        		parentNode: ".J-form",
        		model: {
        			id: "form",
        			layout: "3_1",
        			defaultButton : false,
        			items: [/*{
						name : "memberCertificates",
						label : "会员证号",
						type: "autocomplete",
                        url: "api/signupregister/querycertificates",
                        params:function(str){
	                       	return {
	                       		"pkServicePoint":activeUser.servicePoint.pkServicePoint,
	                       		"fetchProperties":"pkTravelContract,memberCertificates,version,member.personalInfo.name," +
	                       				"member.personalInfo.idNumber,productRule.product.name,productRule.product.pkProduct," +
	                       				"productRule.product.version"
	                       	};
                        	
                        	
                        },
                        queryParamName: "s",
                        //代表所选的选项的值是哪一个字段的值
                        keyField: "pkTravelContract",
                        //代表选项下拉框中显示的值
                        format: function(data) {
                            return data.member.personalInfo.idNumber+"-"+data.member.personalInfo.name+
                            		"-"+data.productRule.product.name+"-"+data.memberCertificates;
                        },
                        onItemSelect : function(data){
                        	form.setValue("pkTravelContract",data.pkTravelContract);
                        	form.setValue("memberCertificates",data.memberCertificates);
                        	form.setValue("productName",data.productRule.product.name);
						},
						validate : [ "required" ]
					},*/{
        				name: "memberCertificates",
        				label:"会员证号",
        				readonly:true,
        				validate : [ "required" ]
        			},{
        				name: "contactNo",
        				label:"合同号",
        				readonly:true,
        				validate : [ "required" ]
        			},{
        				name: "status.value",
						label: "状态",
						readonly:true
        			},{
        				name: "product.name",
						label: "产品",
						readonly:true,
//						type:"select"
        			},{
        				name: "productType.name",
						label: "产品类型",
						readonly:true,
//						type:"select"
        			},{
        				name: "number",
						label: "份数",
						readonly:true
        			},{
        				name: "totalPrice",
						label: "总金额（元）",
						readonly:true,
        			},{
        				name: "signUpDate",
						label: "签约日期",
						type: "date",
						mode:"YYYY-MM-DD",
						readonly:true
        			},{
        				name: "balance",
						label: "余额（元）",
						readonly:true,
						
        			},{
        				name: "name",
						label: "会员",
						readonly:true
        			},{
        				name: "idNumber",
						label: "身份证号",
						readonly:true
        			},{
        				name: "mobilePhone",
						label: "联系电话",
						readonly:true
        			},{
        				name: "defaultRatio",
						label: "违约金比例(%)",
						readonly:true,
						validate : [ "required" ]
        			},{
        				name: "flatCost",
						label: "工本费（元）",
						validate : [ "required" ],
						readonly:true,
        			},{
        				name: "price",
						label: "应退金额（元）",
						readonly:true,
        			},{
						name:"operateDate",
						label:"申请日期",
						type:"date",
//						defaultValue:moment(),
						readonly:true
					},{
						name:"operate",
						label:"经办人",
						readonly:true,
					},{
						name:"pkOperator",
						type:"hidden",
//						defaultValue: activeUser.pkUser
					},{
						name:"cause",
						label:"退证原因",
//						defaultValue : "",
						type:"textarea",
						"break": true,
//						exValidate:function(value){		
//							if(value.length > 100){
//								return "不能超过100个字";
//							}else{
//								return true;
//							}
//						}
					},{
						name:"version",
						type:"hidden",
						defaultValue: "0"
					},{
						name:"pk",
						type:"hidden"
					}]
        		}
        	});
        	widget.set("form",form);
        }
    };
    module.exports = instance;
});
